package com.soulgame.utils;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;

import com.android.volley.VolleyError;
import com.soul.sdk.utils.SGDebug;
import com.soulgame.constant.SGConstants;
import com.soulgame.sgsdkproject.sgtool.DeviceUtil;
import com.soulgame.sgsdkproject.sgtool.net.VolleyRequest;
import com.soulgame.sgsdkproject.sgtool.net.IStringHttpListener;

public class LoginTask {

	public static LoginTask newInstance() {
		return new LoginTask();
	}

	public void doRequest(Context context, String bduid) {

		Map<String, String> pParams = new HashMap<String, String>();
		pParams.put("user_id", bduid);
		pParams.put("appKey", DeviceUtil.getAppKey(context));
		pParams.put("appVersion", DeviceUtil.getVersionName(context));
		pParams.put("imei", DeviceUtil.getIMEI(context));
		pParams.put("channel", DeviceUtil.getChannel(context));
		
		VolleyRequest.sendPostStringRequest(context, SGConstants.APP_SERVER_URL_GET_USER, pParams, new IStringHttpListener() {

			@Override
			public void onResponse(String response) {

				SGDebug.d("LoginTask onResponse = " + response);
			}

			@Override
			public void onErrorResponse(VolleyError error) {
				SGDebug.w("LoginTask onErrorResponse = " + error.getMessage());
			}
		});

	}

}
